import Cookies from 'js-cookie'

const TokenKey = 'token'
const UserIdKey = 'userId'
const RoleKey = 'roles'

//存储token
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

//存储userId
export function getUserId() {
  return Cookies.get(UserIdKey)
}

export function setUserId(userId) {
  return Cookies.set(UserIdKey, userId)
}

export function removeUserId() {
  return Cookies.remove(UserIdKey)
}

//存储用户角色
export function getRole() {
  return Cookies.get(RoleKey)
}

export function setRole(roles) {
  return Cookies.set(RoleKey, roles)
}

export function removeRole() {
  return Cookies.remove(RoleKey)
}